﻿using System.Web.Mvc;
using FriendStar.Code;
using FriendStar.Application.VBaseData;
using FriendStar.Domain.Entity.VBaseData;

namespace FriendStar.Web.Areas.VBaseData.Controllers
{
    public class V_CPK_45_HZ_StoCPKListAcco_MidController : ControllerBase
    {
        //
        // GET: /VBaseData/V_CPK_45_HZ_StoCPKListAcco_Mid/
        private V_CPK_45_HZ_StoCPKListAcco_MidApp v_cpk_45_HZ_StoCPKListAcco_MidApp = new V_CPK_45_HZ_StoCPKListAcco_MidApp();
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetGridJson(string keyword)
        {
            var data = v_cpk_45_HZ_StoCPKListAcco_MidApp.GetList();
            return Content(data.ToJson());
        }
      
        /// <summary>
        /// 入库档案
        /// </summary>
        /// <param name="pagination">分页信息</param>
        /// <param name="companyname"></param>
        /// <param name="productionno"></param>
        /// <param name="fcurdate"></param>
        /// <param name="fvoucherno"></param>
        /// <param name="ledgerdate"></param>
        /// <returns></returns>
        public ActionResult StoInCPKMidList(Pagination pagination, string companyno, string productionno, string fcurdate, string fvoucherno, string faccountDate, string fdocuno, string type)
        {
            var data = new
            {
                rows = v_cpk_45_HZ_StoCPKListAcco_MidApp.StoInCPKMidList(pagination, companyno, productionno, fcurdate, fvoucherno, faccountDate, fdocuno, type),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };
            return Content(data.ToJson());
        }

        public ActionResult StoInCPKMidListForPrint(string fdocuno)
        {
            var data = v_cpk_45_HZ_StoCPKListAcco_MidApp.GetList(fdocuno);
            return Success(string.Format("获取到{0}条数据", data.Count), data.ToJson());
        }
        public ActionResult GetOutParameterGridJson(Pagination pagination, string companyname, string productionno, string fcurdate, string fvoucherno, string ledgerdate)
        {
            var data = new
            {
                rows = v_cpk_45_HZ_StoCPKListAcco_MidApp.GetOutParameterGridJson(pagination, companyname, productionno, fcurdate, fvoucherno, ledgerdate),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };
            return Content(data.ToJson());
        }
    }
}
